package swapper.view.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import swapper.facade.CategoriaFacade;

/**
 *
 * @author Valentino
 */
public class CategoriaController extends AbstractControlador{
    private CategoriaFacade categoriafacade;
    
    
    public void setCategoriaFacade(CategoriaFacade categoriafacade)
    {
        this.categoriafacade=categoriafacade;
    }
    @Override
    protected ModelAndView handleRequestInternal(HttpServletRequest hsr, HttpServletResponse hsr1) throws Exception {
        //Atualiza sessao
        isLogado(hsr);

        ModelAndView modelAndView = new ModelAndView("categorialista","categoriaAll", categoriafacade.listAll());
        modelAndView.addObject("logado", isLogado(hsr));
        modelAndView.addObject("pessoaSessao", getPessoaSession(hsr));
        //modelAndView.addObject("status",categoriafacade.teste());
        return modelAndView;
        
        
    }
    
    
    
}
